- content_for :title, app.name

- content_for :head do
  = auto_discovery_link_tag :atom, app_path(app, User.token_authentication_key => current_user.authentication_token, format: :atom), title: t(".atom_title", name: app.name, host: request.host)

- content_for :meta do
  - if app.current_app_version.present?
    %strong= "Latest App Version:"
    = app.current_app_version
  %strong= t(".errors_caught")
  = app.problems.count
  %strong= t(".api_key")
  = app.api_key

- content_for :action_bar do
  - if current_user.admin?
    = link_to t(".edit"), edit_app_path(app), class: "button"
  - if all_errs
    = link_to t(".unresolved_errs"), app_path(app, sort: params_sort, order: params_order), class: "button"
  - else
    = link_to t(".all_errs"), app_path(app, all_errs: true, sort: params_sort, order: params_order), class: "button"

  - if app.watched_by?(current_user)
    = link_to t(".unwatch"), app_watchers_path(app_id: app), method: :delete, class: "button"
  - else
    = link_to t(".watch"), app_watchers_path(app_id: app), method: :post, class: "button"

%h3#watchers_toggle
  = t(".watchers")
  %span.click_span= t(".show_hide")
#watchers_div
  - if app.notify_all_users
    %table.watchers
      %thead
        %tr
          %th= t(".all_users_notified")
  - else
    %table.watchers
      %thead
        %tr
          %th= t(".user_or_email")
      %tbody
        - app.watchers.each do |watcher|
          %tr
            %td= watcher.label
        - if app.watchers.none?
          %tr
            %td
              %em= t(".no_watchers")

- if app.github_repo?
  %h3#repository_toggle
    = t(".repository")
    %span.click_span= t(".show_hide")
  #repository_div
    %table.repository
      %thead
        %tr
          %th= t(".github_repo")
      %tbody
        %tr
          %td= link_to(app.github_repo, app.github_url, target: "_blank", rel: "noopener noreferrer")

- if app.problems.any?
  %h3.clear= t(".errors")
  %section
    = render "problems/search", all_errs: all_errs, app_id: app.id, params_sort: params_sort, params_order: params_order
  %br
  %section
    .problem_table{id: "problem_table"}
      = render "problems/table", problems: problems
- else
  %h3.clear= t(".no_error_yet")
  = render "configuration_instructions_wrapper", app: app
